package edu.cuit.avatar.inherit;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 几何图形
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/9 15:27
 */
public class Geometric {
    /**
     * 颜色
     */
    private String color = "white";
    /**
     * 是否填充
     */
    private boolean filled;
    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    public Geometric(){
        System.out.println("Geometric的构造方法,初始化几何图形创建时间为系统当前时间");
        this.createTime = LocalDateTime.now();
    }

    public Geometric(String color, boolean filled){
        this();
        System.out.println("Geometric的构造方法,初始化几何图形的信息");
        this.color = color;
        this.filled = filled;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public boolean isFilled() {
        return filled;
    }

    public void setFilled(boolean filled) {
        this.filled = filled;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    /**
     * 返回几何图形的字符串描述信息
     * @return 几何图形描述信息
     */
    @Override
    public String toString(){
        return String.format("created on %s, color:%s and filled:%b",
                DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(createTime), color, filled);
    }
}
